﻿<basics2:ChildWindow x:Class="Rawr.Mage.CustomSpellMixDialog"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:basics2="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:local="clr-namespace:Rawr.Mage"
           Width="286" Height="295" 
           Title="Custom Spell Mix Editor">
    <basics2:ChildWindow.Resources>
        <local:SpellEnumConverter x:Key="spellEnumConverter"/>
		<local:NullToBooleanConverter x:Key="nullToBoolConverter"/>
		<DataTemplate x:Key="DataTemplateSpell">
			<ComboBox ItemsSource="{Binding NameList, Source={StaticResource spellEnumConverter}}" SelectedItem="{Binding Path=Spell, Mode=TwoWay, Converter={StaticResource spellEnumConverter}}" />
		</DataTemplate>
	</basics2:ChildWindow.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <!--IFWPF
        <data:DataGrid x:Name="Data" AutoGenerateColumns="False" Grid.Row="0" ItemsSource="{Binding}" CanUserAddRows="False">
        ENDIFWPF-->
        <!--IFSL-->
        <data:DataGrid x:Name="Data" AutoGenerateColumns="False" Grid.Row="0" ItemsSource="{Binding}">
        <!--ENDIFSL-->
            <data:DataGrid.Columns>
				<data:DataGridTemplateColumn Header="Spell" SortMemberPath="Spell" CellTemplate="{StaticResource DataTemplateSpell}" />
				<!--IFWPF
                <data:DataGridTextColumn Width="*" Header="Weight" Binding="{Binding Weight}" SortMemberPath="Weight" />
                ENDIFWPF-->
                <!--IFSL-->
                <data:DataGridTextColumn Header="Weight" Binding="{Binding Weight}" SortMemberPath="Weight" />
                <!--ENDIFSL-->
            </data:DataGrid.Columns>
        </data:DataGrid>
        <StackPanel HorizontalAlignment="Right" Grid.Row="1" Orientation="Horizontal">
            <Button Margin="4,4,4,4" Content="Add" Click="Add_Click" />
            <Button Margin="4,4,4,4" Content="Remove" IsEnabled="{Binding ElementName=Data, Path=SelectedItem, Converter={StaticResource nullToBoolConverter}}" Click="Remove_Click" />
        </StackPanel>
    </Grid>
</basics2:ChildWindow>